'use strict'
import React from 'react'
import style from './css.css'
import HomePage from './homePage'
import ListPage from './listPage'
import queryString from 'query-string'
const urlData = queryString.parse(location.search)

class App extends React.Component {
  constructor (props) {
    super(props)
    this.state = {
      page: 0,
      name
    }
  }

  _renderPage () {
    const { page, name } = urlData
    if (!page) { return <HomePage /> }
    if (page) { return <ListPage name={name} /> }
  }

  render () {
    return (
      <div className={style.all}>
        <div className={style.box}>
          {this._renderPage()}
        </div>
      </div>
    )
  }
}

export default App
